name := "equipment-ext-builder-flink"

version := "0.1"

ThisBuild / resolvers ++= Seq(
  "Apache Development Snapshot Repository" at "https://repository.apache.org/content/repositories/snapshots/",
  Resolver.mavenLocal
)

organization := "com.eshipenet.shipnet"

ThisBuild / scalaVersion := "2.12.8"

val flinkVersion = "1.9.0"

// https://mvnrepository.com/artifact/com.typesafe.play/play-json
libraryDependencies += "com.typesafe.play" %% "play-json" % "2.6.9"
libraryDependencies += "com.github.nscala-time" %% "nscala-time" % "2.20.0"
// https://mvnrepository.com/artifact/com.github.etaty/rediscala
libraryDependencies += "com.github.etaty" %% "rediscala" % "1.8.0"

libraryDependencies += "org.scalactic" %% "scalactic" % "3.0.5"
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.5" % "test"

val flinkDependencies = Seq(
  "org.apache.flink" %% "flink-scala" % flinkVersion % "provided",
  "org.apache.flink" %% "flink-streaming-scala" % flinkVersion % "provided",
  "org.apache.flink" %% "flink-test-utils" % flinkVersion % "provided",
  // https://mvnrepository.com/artifact/org.apache
  // .flink/flink-connector-kafka-0.11
  "org.apache.flink" %% "flink-connector-kafka" % flinkVersion)


lazy val root = (project in file(".")).
  settings(
    libraryDependencies ++= flinkDependencies
  )

assembly / mainClass := Some("com.eshipenet.shipnet.equipmentextbuilder.Main")

// make run command include the provided dependencies
Compile / run  := Defaults.runTask(Compile / fullClasspath,
  Compile / run / mainClass,
  Compile / run / runner
).evaluated

// stays inside the sbt console when we press "ctrl-c" while a Flink programme executes with "run" or "runMain"
Compile / run / fork := true
Global / cancelable := true

// exclude Scala library from assembly
assembly / assemblyOption  := (assembly / assemblyOption).value.copy(includeScala = false)
